vue
<template>
  <!-- <h1>数据展示</h1> -->
  <GoodsShow :products="products" />
</template>

<script setup>
// 引入商品展示组件
import GoodsShow from '@/components/goods.vue'
// 引入axios
import axios from 'axios'
import { ref, onMounted } from 'vue'
// 定义商品列表数据
const products = ref([])
onMounted(async () => {
  // 获取商品数据
  const res = await axios('/api/goods')
  console.log(res.data);
  products.value = res.data
})

</script>